<?php

namespace App\Http\Middleware;

use Closure;

class PersonLogin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        # token
        //$requestToken  = !empty($_COOKIE['request_token']) ? $_COOKIE['request_token'] : null;
        $requestToken  = !empty(session('request_token')) ? session('request_token') : null;
        if (session('second')==0 && $request->is('admin/*')) {
            return redirect('admin/secondPassword');
        } elseif (!$requestToken) {

        }

        return $next($request);
    }
}
